use std::time::{SystemTime, UNIX_EPOCH};

use hex::byte_to_hex_str;

pub mod hex;

const MD5_EXT: &'static str = "bread_md5.ext";

pub fn md5_encode(s: &str) -> String {
    let buf = format!("{}{}", s, MD5_EXT);
    let m = md5::compute(buf);
    byte_to_hex_str(&m.0)
}

pub fn current_timestamp() -> u64 {
    SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .unwrap()
        .as_secs()
}
